import assessCheckApi from './api'
import { axios } from '@/utils/request'
import router from '@/router/index'
import blobType from '@/common/blobType'
var menuType = blobType.menuType
var fywflcodeArr = blobType.fywflcodeArr
var fywflcode = ''
export function ocalityPostAction(data) {
    //console.log('字典传参',data)
    return axios({
      url: assessCheckApi.dict,
      method:'get' ,
      params:data,
      url_1:'outside'
    })
  }
  //列表
export function dataList(params){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.list,
    method:'get' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}
// id查询列表信息
export function searchIdData(params){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.searchIdData,
    method:'get' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}
//批量删除
export function deleteArrServe(params){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.deleteArr,
    method:'delete' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}
//删除
export function deleteItemServe(params){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.deleteItem,
    method:'delete' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}
//新增
export function addServe(data){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.addData,
    method:'post' ,
    data:data?{...data,fywflcode:fywflcode?fywflcode:(data.fywflcode?data.fywflcode:'')}:{},
    url_1:'outside'
  })
}
//编辑
export function editServe(data){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.editData,
    method:'put' ,
    data:data?{...data,fywflcode:fywflcode?fywflcode:(data.fywflcode?data.fywflcode:'')}:{},
    url_1:'outside'
  })
}
// 保存试卷
export function checkSjData(params){
  fywflcode = fywflcodeArr[menuType.indexOf(router.app._route. name.substring(router.app._route.name.indexOf('__'),router.app._route.name.indexOf('_a')+2))]
  return axios({
    url: assessCheckApi.checkSjData,
    method:'get' ,
    params:params?{...params,fywflcode:fywflcode?fywflcode:(params.fywflcode?params.fywflcode:'')}:{},
    url_1:'outside'
  })
}
// 移除试卷
export function removeSjData(params){
  return axios({
    url: assessCheckApi.removeSjData,
    method:'get' ,
    params:{...params},
    url_1:'outside'
  })
}
// 查询参与培训人员
export function searchPxryData(params){
  return axios({
    url: assessCheckApi.searchPxryData,
    method:'get' ,
    params:{...params},
    url_1:'outside'
  })
}
//根据Id查询
export function queryById(data){
  return axios({
    url: assessCheckApi.queryById,
    method:'get' ,
    params:{...data},
    url_1:'outside'
  })
}
//添加培训人员
export function addPxry(data){
  return axios({
    url: assessCheckApi.selectCjryToPx,
    method:'post' ,
    data:{...data},
    url_1:'outside'
  })
}
// 批量删除培训人员
export function deletePxCjryArray(params){
  return axios({
    url: assessCheckApi.deletePxCjry,
    method:'delete' ,
    params:{...params},
    url_1:'outside'
  })
}
//给培训人员发送试卷
export function sendSjToPxCjry(data){
  return axios({
    url: assessCheckApi.sendSjToPxCjry,
    method:'get' ,
    params:{...data},
    url_1:'outside'
  })
}
//给培训人员发送试卷短信
export function sendSjSms(data){
  return axios({
    url: assessCheckApi.sendSjSms,
    method:'post' ,
    data:{...data},
    url_1:'outside'
  })
}
//更新参加人员信息
export function updateCjryXx(data){
  return axios({
    url: assessCheckApi.updateCjryXx,
    method:'post' ,
    data:{...data},
    url_1:'outside'
  })
}
// 查看参加培训人员的答卷详情
export function queryPxrySjxxPageList(data){
  return axios({
    url: assessCheckApi.queryPxrySjxxPageList,
    method:'get' ,
    params:{...data},
    url_1:'outside'
  })
}
//批量生成个人培训记录
export function batchCreateMyPxjl(data){
  return axios({
    url: assessCheckApi.batchCreateMyPxjl,
    method:'post' ,
    data:{...data},
    url_1:'outside'
  })
}
//用户培训记录-批量删除
export function deleteBatchUserPxjl(params){
  return axios({
    url: assessCheckApi.deleteBatchUserPxjl,
    method:'delete' ,
    params:{...params},
    url_1:'outside'
  })
}
//用户培训记录-编辑
export function editUserPxjl(data){
  return axios({
    url: assessCheckApi.editUserPxjl,
    method:'put' ,
    data:{...data},
    url_1:'outside'
  })
}
// 下载培训参加人员-导入模板
export function downCjryTemplate(data){
  return axios({
    url: assessCheckApi.downCjryTemplate,
    method:'get' ,
    params:{...data},
    url_1:'outside',
    responseType: 'arraybuffer'
  })
}
// 导入培训参加人员数据-表格excel
export function impPxCjryData(data){
  return axios({
    url: assessCheckApi.impPxCjryData,
    method:'post' ,
    data:data,
    url_1:'outside'
  })
}


